using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebUpdaterAdminCore.Utils
{
    public class SocketResponeHelper
    {
        public static async Task<Models.MsgReceiveModel> GetRespone(string uid,int waitMillisecond = 20,int retryCount = 10)
        {
            var msg = UpdaterSocketServerService.GetReceiveMsg(uid);
            for (int i = 0; i < retryCount; i++)
            {
                if (msg == null)
                {
                    await Task.Delay(waitMillisecond * i);
                    msg = UpdaterSocketServerService.GetReceiveMsg(uid);
                }
                else
                {
                    break;
                }
            }
            return msg;
        }
    }
}
